<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
	  xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="container-div">
	<div class="row">
		<div class="col-sm-10 search-collapse">
			<form id="dayUser-formId">
				<div class="select-list">
					<ul>
						<li>
							客户姓名：<input type="text" name="cardUserName"/>
						</li>

						<li>
							销售顾问：<input type="text" name="loginName"/>
						</li>

                        <li>
                            手机号码：<input type="text" name="phoneNumber"/>
                        </li>
						<!--<li>
							办卡类型：<input type="text" name="cardStyle"/>
						</li>-->
						<!--<li>
							课堂类型：<input type="text" name="classType"/>
						</li>-->
						<li>
                            到期时间：<input type="date" name="pastTime"/>
						</li>
						<!--<li>
                            删除标志（0代表存在 2代表删除)
                            <select name="type" th:with="type=${@dict.getType('sys_del')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </li>-->


					<!--	<li class="select-time">
							<label>创建时间： </label>
							<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
							<span>-</span>
							<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
						</li>-->

						<li>
							<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
						</li>
					</ul>
				</div>
			</form>
		</div>

		<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
			<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="attend:dayUser:add">
				<i class="fa fa-plus"></i> 添加
			</a>
			<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="attend:dayUser:edit">
				<i class="fa fa-edit"></i> 修改
			</a>
			<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="attend:dayUser:remove">
				<i class="fa fa-remove"></i> 删除
			</a>
			<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="attend:dayUser:export">
				<i class="fa fa-download"></i> 导出
			</a>
			<!--<a class="btn btn-danger " onclick="$.operate.attendAll()" >
				<i class="fa fa-star-half-o"></i> 打卡
			</a>-->
		</div>
		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true"></table>
		</div>
	</div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('attend:dayUser:edit')}]];
    var removeFlag = [[${@permission.hasPermi('attend:dayUser:remove')}]];
    //var attendFlag = [[${@permission.hasPermi('attend:dayUser:attend')}]];
    var datas = [[${@dict.getType('sys_user_sex')}]];
    var prefix = ctx + "attend/dayUser";
    $(function() {
       // $('body').layout({ west__size: 185 });
        queryList();
    });
  //  $(function() {
    function queryList() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "打卡记录",
            search: false,
            showExport: true,
            columns: [{
                checkbox: true
            },
                {
                    field: 'cardUserId',
                    title: '客户id',
                    visible: false
                },
                {
                    field: 'avatar',
                    title: '头像',
                    align: 'center',
                    iconSize: 'xs',
                    formatter: function (value, row, index) {
                        //图片回显
                        var imgUrl = "/avatar"+row.avatar;
                        if (row.avatar == '' || row.avatar == null) {
                            imgUrl = "/img/profile.jpg";
                        }
                        return '<img src=' + imgUrl + ' class="img-rounded" style="width:50px;height:50px;" >'
                    }
                },
                {
                    field : 'cardId',
                    title : '学员卡号'
                },
                {
                    field: 'cardUserName',
                    title: '学员姓名'
                },
                {
                    field: 'loginName',
                    title: '课程顾问'
                },
                {
                    field: 'phoneNumber',
                    title: '电话'
                },
                {
                    field: 'sex',
                    title: '性别',
                    align: 'center',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(datas, value);
                    }
                   /* formatter: function() {
                        // @{/profile/avatar/} + ${value.avatar}
                        var actions = [];
                        actions.push("<span><img th:src='@{/img/profile.jpg}'  alt='image' class='img-circle' height='60' width='60'/></span>");
                        return actions.join('');
                    }*/
                },
                {
                    field : 'classType',
                    title : '课堂类型'
                },
                {
                    field : 'cardStyle',
                    title : '办卡类型',
                    align: 'center'
                   /* formatter: function(value, row, index) {
                        return $.table.selectDictLabel(datas, value);
                    }*/
                },
                {
                    field : 'classCount',
                    title : '课时数量'
                },
                {
                    field : 'createTime',
                    title : '创建时间',
                    sortable: true
                },
                {
                    field : 'updateTime',
                    title : '修改时间',
                    sortable: true
                },
                {
                    field : 'remark',
                    title : '备注信息'
                },
                {
                    field : 'pastTime',
                    title : '到期时间',
                    sortable: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.cardUserId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.cardUserId + '\')"><i class="fa fa-remove"></i>删除</a>');
                       /* actions.push('<a class="btn btn-primary btn-xs ' + attendFlag + '" href="#" onclick="$.operate.attend(\'' + row.cardUserId + '\')"><i class="fa fa-star"></i>打卡</a>');*/
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    }
   // });
</script>
</body>
</html>